import random
import time


# l1 = [random.randint(0, 10000) for i in range(10000)]
# l2 = l1.copy()
#
#
# # print(l1 == l2, id(l1) == id(l2))
#
#
# def time_cost(f):
# 	def calc():
# 		start = time.time()
# 		f()
# 		print(f"函数{f.__name__} 开销{time.time() - start}")
#
# 	return calc
#
#
# @time_cost
# def sort1():
# 	l1.sort()
# 	print(l1)
#
#
# # start = time.time()
# # sort1()
# # print(time.time()-start)
#
# @time_cost
# def sort2():
# 	temp = sorted(l2)
# 	print(temp)
#
#
# # start = time.time()
# # sort2()
# # print(time.time()-start)
#
#
#
#
# # 本质就是闭包  把原函数加工  加工以后的函数名还使用原始函数名
# # sort1 = time_cost(sort1)
# # sort1()
# #
# # sort2 = time_cost(sort2)
# # sort2()
#
#
#
# sort1()
#
# sort2()


# from django.contrib.auth.decorators import login_required


def log_record(f):
	def record(*args):
		r = f(*args)
		print(f"函数:{f.__name__} 参数:{args} 执行结果:{r}")
		return r

	return record


@log_record
def do_task(*args):
	temp = 0
	for arg in args:
		temp += arg
	return temp

@log_record
def get_max(*args):
	return max(args)

# print(do_task(1, 2, 3))


# do_task = log_record(do_task)
print(do_task(1, 2, 3))


print(get_max(1,2,3))

